<h1>Upload a New Document</h1>

<% form_for(@document, :html => { :multipart => true }) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :description %><br />
    <%= f.text_area :description, :rows => "1", :cols => "40"  %>
  </p>
  <p>Attachments: (maximum of <%= Document::Max_Attachments %> documents, under <%= Document::Max_Attachment_Size/1.megabyte%>MB)
      <% if @document.assets.count >= Document::Max_Attachments %>
        <input id="newfile_data" type="file" disabled />
      <% else %>
        <input id="newfile_data" type="file" />
      <% end %>
      <div id="attachment_list"><ul id="pending_files"></ul></div>
      <script type="text/javascript">
          var multi_selector = new MultiSelector($('pending_files'), <%= Document::Max_Attachments %>);
          multi_selector.addElement($('newfile_data'));
      </script>
  </p>
  <p>
    <%= f.submit "Create" %>
  </p>
<% end %>

<%= link_to 'Back', documents_path %>
